package com.itheima.service.impl;

import com.itheima.dao.UserDao;
import com.itheima.dao.UserRoleDao;
import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;
    @Autowired
    private UserRoleDao userRoleDao;
    /**
     * 根据用户名查询用户信息
     * @param username
     * @return
     */
    public User loadUserByUsername(String username) {
        return userDao.loadUserByUsername(username);
    }

    /**
     * 根据用户ID查询用户的角色
     * @param id
     * @return
     */
    public User loadRolesByUserId(Integer id) {
        return userRoleDao.loadRolesByUserId(id);
    }
}
